package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.Autofill;
import com.sky.dto.SetmealDTO;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import com.sky.vo.SetmealOverViewVO;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealMapper {


    /**
     * 根据分类id查询套餐信息(C端)
     *
     * @param id 分类id
     */
    @Select("select * from setmeal where category_id = #{id}")
    List<Setmeal> selectByCategoryId(Long id);

    /**
     * 套餐分页条件查询
     *
     * @param dto
     * @return
     */
    Page<SetmealVO> pageList(SetmealPageQueryDTO dto);

    /**
     * 更新套餐信息
     *
     * @param setmeal
     */
    @Autofill(OperationType.UPDATE)
    void update(Setmeal setmeal);

    /**
     * 根据id查询套餐
     *
     * @param id 套餐id
     * @return vo
     */
    SetmealVO selectById(Long id);

    /**
     * 添加套餐
     * @param setmeal 套餐信息
     */
    @Autofill(OperationType.INSERT)
    void insert(Setmeal setmeal);

    /**
     * 根据id删除套餐
     * @param id 套餐id
     */
    @Delete("delete from setmeal where id =#{id}")
    void deleteById(Long id);

    /**
     * 查询套餐总览
     * @return vo
     */
    SetmealOverViewVO getOverviewSetmeals();
}
